var t = getApp();

Page({
    data: {
        show: !1,
        page: 1,
        showcarrfootBol: !1,
        showcarrfoot_ipxBol: !1
    },
    onLoad: function(t) {
        this.getdata();
    },
    toBd: function(t) {
        console.log(t);
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageH/shopRanking/shopRankingList/shopRankingList?id=" + a
        });
    },
    goDetail: function(t) {
        var a = t.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageA/detail_v2/detail_v2?id=" + a
        });
    },
    tapBtn: function() {
        this.setData({
            show: !0
        });
    },
    onClickLeft: function() {
        this.setData({
            show: !1
        });
    },
    showcarrfoot_ipx: function(t) {
        var a = t.detail;
        this.setData({
            showcarrfoot_ipxBol: a
        });
    },
    showcarrfoot: function(t) {
        var a = t.detail;
        this.setData({
            showcarrfootBol: a
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (!(this.data.current_page >= this.data.last_page)) {
            var t = this.data.page + 1;
            this.setData({
                page: t
            }), this.getMoreData();
        }
    },
    onShareAppMessage: function() {
        var t = this.data.setting.share_logo, a = this.data.setting.share_title, n = this.data.setting.title;
        return {
            title: a || n,
            path: "/packageH/shopRanking/shopRanking/index",
            imageUrl: t || ""
        };
    },
    getdata: function() {
        wx.showLoading({
            title: "加载中"
        });
        var a = this, n = t.getNetAddresss("plugin.goods-ranking.api.index.rank-list");
        t._postNetWork({
            url: n,
            data: {
                page: this.data.page
            },
            success: function(t) {
                var n = t.data;
                wx.hideLoading({
                    success: function(t) {}
                }), 1 == n.result ? (a.setData({
                    rank_list: n.data.data.rank_list,
                    setting: n.data.data.setting,
                    current_page: n.data.current_page,
                    last_page: n.data.last_page
                }), wx.setNavigationBarTitle({
                    title: n.data.data.setting.title
                })) : wx.showToast({
                    title: n.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    getMoreData: function() {
        wx.showLoading({
            title: "加载中"
        });
        var a = this, n = t.getNetAddresss("plugin.goods-ranking.api.index.rank-list");
        t._postNetWork({
            url: n,
            data: {
                page: this.data.page
            },
            success: function(t) {
                var n = t.data;
                if (wx.hideLoading({
                    success: function(t) {}
                }), 1 == n.result) {
                    var i = n.data.data.rank_list;
                    a.data.rank_list = a.data.rank_list.concat(i), a.setData({
                        rank_list: a.data.rank_list,
                        current_page: n.data.current_page,
                        last_page: n.data.last_page
                    });
                } else wx.showToast({
                    title: n.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    }
});